<div id="un"> <!-- begin (un) id for styling -->

<h1><?php echo HEADING_TITLE . UN_LABEL_DELIMITER . $wishlist->fields['name']; ?></h1>

<p><?php echo TEXT_DESCRIPTION; ?></p>

<?php 
if ( $messageStack->size('un_wishlist') > 0 ) { 
	echo $messageStack->output('un_wishlist'); 
}
?>

<ul>
	<li><a href="<?php echo zen_href_link(UN_FILENAME_WISHLIST_EMAIL, 'wid='.$id, 'SSL'); ?>"><?php echo UN_TEXT_EMAIL_WISHLIST; ?></a></li>
	<li><a href="<?php echo zen_href_link(UN_FILENAME_WISHLIST_FIND); ?>"><?php echo UN_TEXT_FIND_WISHLIST; ?></a></li>
	<?php if ( UN_ALLOW_MULTIPLE_WISHLISTS===true ) { ?>
	<li><a href="<?php echo zen_href_link(UN_FILENAME_WISHLISTS, '', 'SSL'); ?>"><?php echo UN_TEXT_MANAGE_WISHLISTS; ?></a></li>
	<li><a href="<?php echo zen_href_link(UN_FILENAME_WISHLIST_MOVE, 'wid='.$id, 'SSL'); ?>"><?php echo UN_TEXT_WISHLIST_MOVE; ?></a></li>
	<?php } ?>
</ul>

<!-- control -->
<?php echo zen_draw_form('control', zen_href_link(UN_FILENAME_WISHLIST, '', 'SSL'), 'get', 'class="control"'); ?>
<?php echo zen_hide_session_id(); ?>
<?php echo zen_draw_hidden_field('main_page', UN_FILENAME_WISHLIST); ?>
<?php echo zen_draw_hidden_field('wid', $id); ?>
<fieldset>

	<div class="multiple">
	<label for="sort"><?php echo UN_TEXT_SORT . UN_LABEL_DELIMITER; ?></label>
	<?php 
	echo zen_draw_pull_down_menu('sort', $aSortOptions, (isset($_GET['sort']) ? $_GET['sort'] : ''), 'class="m" onchange="this.form.submit()"');
	?>
	</div>
	
<?php if ( UN_DISPLAY_CATEGORY_FILTER===true ) { ?>
	<div class="multiple">
	<label for="cPath"><?php echo UN_TEXT_SHOW . UN_LABEL_DELIMITER; ?></label>
	<?php
	echo un_draw_categories_pull_down_menu('cPath', UN_TEXT_ALL_CATEGORIES, (isset($_GET['cPath']) ? $_GET['cPath'] : ''), 'class="m" onchange="this.form.submit()"');
	?>
	</div>
<?php } ?>

	<div class="multiple">
	<label for="layout"><?php echo UN_TEXT_VIEW . UN_LABEL_DELIMITER; ?></label>
	<?php 
	echo un_draw_view_pull_down_menu('layout', '', (isset($_GET['layout']) ? $_GET['layout'] : ''), 'class="m" onchange="this.form.submit()"');
	?>
	</div>
	<div class="clearleft"></div>
	
</fieldset>
</form>
<!-- control -->
 
<?php if (($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) { ?>

	<dl class="pageresults">
	<dd><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></dd>
	<dd><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, zen_get_all_get_params(array('page', 'info', 'x', 'y', 'main_page'))); ?></dd>
	</dl>
	
<?php } // end paging top ?>

<?php echo zen_draw_form('wishlist', zen_href_link(UN_FILENAME_WISHLIST, zen_get_all_get_params(array('action'), 'SSL') . 'action=un_update_wishlist')); ?>
<?php echo zen_hide_session_id(); ?>
<?php echo zen_draw_hidden_field('layout', isset($_REQUEST['layout'])? $_REQUEST['layout']: ''); ?>

<!-- product listing -->
<div class="tableheading"><?php echo TEXT_LISTING_TYPE; ?></div>
<?php
if ($listing_split->number_of_rows > 0) {
	$rows = 0;
	$products = $db->Execute($listing_split->sql_query);
	while (!$products->EOF) {
		if ( $rows & 1 ) {
			$tdclass = 'even';
		} else {
			$tdclass = 'odd';
		}
		$products_price = zen_get_products_display_price($products->fields['products_id']);
?>

		<div class="wishlist<?php echo (!un_is_empty($tdclass)? '-'.$tdclass: ''); ?>">
		
		<!-- buttons -->
		<?php echo '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products->fields['products_id']) . '" title="'.BUTTON_IN_CART_ALT.'">' . zen_image_button(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT, 'style="float: right; margin-left: 5px;"') . '</a>'; ?>
		<?php echo '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=un_remove_wishlist&products_id=' . $products->fields['products_id']) . '" title="'.UN_TEXT_REMOVE_WISHLIST.'">' . zen_image_button(BUTTON_IMAGE_DELETE, BUTTON_DELETE_ALT, 'style="float: right;"') . '</a>'; ?>

		<!-- product data -->
		<h3><?php echo $products->fields['products_name']; ?></h3>
		<?php echo zen_image(DIR_WS_IMAGES . $products->fields['products_image'], $products->fields['products_name'], '', '', 'class="productlist"'); ?>
		
		<ul>		
		<li class="price"><?php echo TEXT_BASE_PRICE . $products_price; ?></li>

		<?php if ( SHOW_PRODUCT_INFO_DATE_AVAILABLE && ( $products->fields['products_date_available'] > date('Y-m-d H:i:s') ) ) { ?>
		<li class="notabene"><?php echo sprintf(UN_TEXT_DATE_AVAILABLE, zen_date_short($products->fields['products_date_available'])); ?></li>
		<?php } ?>
		
		<li><?php echo '<a href="' . zen_href_link(zen_get_info_page($products->fields['products_id']), 'products_id=' . $products->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>'; ?></li>
		</ul>
		<div class="clearleft"></div>
		
		<!-- wishlist data -->
		<div class="wishlistfields">
		
		<input type="hidden" name="products_id[]" value="<?php echo $products->fields['products_id']; ?>" />
		
		<!-- buttons -->
		<?php echo zen_image_submit(UN_BUTTON_IMAGE_SAVE, UN_BUTTON_SAVE_ALT, 'style="float: right;"'); ?>
		<ul>
		<?php if ( $products->fields['date_added'] ) { ?>
		<li><label class="tabbed-m"><?php echo UN_TEXT_DATE_ADDED . UN_LABEL_DELIMITER; ?></label> 
		<span class="label"><?php echo zen_date_short($products->fields['date_added']); ?></span></li>
		<?php } ?>
		<li>
		<label class="tabbed-m" for="wishlist_quantity[]"><?php echo UN_TEXT_QUANTITY . UN_LABEL_DELIMITER; ?></label>
		<?php echo zen_draw_input_field('wishlist_quantity[]', $products->fields['quantity'], 'size="2" maxlength="3" class="xs"'); ?>
		</li>
		<li>
		<label class="tabbed-m" for="comment[]"><?php echo UN_TEXT_COMMENT . UN_LABEL_DELIMITER; ?></label>
		<?php 
		echo zen_draw_input_field('comment[]', $products->fields['comment'], 'maxlength="255" class="l"');
		?>
		</li>
		<li>
		<label class="tabbed-m" for="priority[]"><?php echo UN_TEXT_PRIORITY . UN_LABEL_DELIMITER; ?></label>
		<?php 
		echo un_draw_priority_pull_down_menu('priority[]', '', $products->fields['priority'], 'class="l"');
		?>
		</li>
		</ul>
		</div> <!-- end div.wishlistfields -->
		
		</div> <!-- end div.wishlist -->
		<?php $rows ++; ?>
		<?php $products->MoveNext(); ?>
	<?php } // end while products ?>
	
<?php } else { ?>
	<p><?php echo UN_TEXT_NO_PRODUCTS; ?></p>
	
<?php } // end if products ?>
<!-- end product listing -->
</form>

<?php if (($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) { ?>

	<dl class="pageresults">
	<dd><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></dd>
	<dd><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, zen_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></dd>
	</dl>

<?php } // end paging bottom ?>

</div> <!-- end (un) id for styling -->